package com.chianghao.rockframewrok.core.frame.service;

import com.chianghao.rockframewrok.core.mybatis.plugins.Paging;

import java.util.List;

/**
 * @author  chiang hao
 * @time    2020 9 1
 * @param <T>
 */
public interface IBaseService<T> {


    /**
     * 插入必须要Entity中主键是code ，且非空
     * @param bean
     */
    public void insert(T bean);

    /**
     * 批量插入
     * @param beans
     */
    public void insertBatch(List<T> beans);



    /**
     * 查询list
     * @param where
     * @return
     */
    public List<T> query(T where);

    /**
     * 查询分页list
     * @param where
     * @param paging
     * @return
     */
    public List<T> queryPage(T where, Paging paging);


    /**
     * 根据传入的实体查新
     * @param where
     * @return
     */
    public T queryBean(T where);

    public void deleteById(Object id);

    public void deleteByCode(Object code);

    public void updateById(T bean,Object id);

    public void updateByCode(T bean,Object code) ;

    public T queryOneById(Object id);

    public T queryOneByCode(Object code) ;

}
